<?php /*a:7:{s:72:"E:\web\wwwroot\blog_tp5\application\admin\view\content\article_edit.html";i:1555423762;s:63:"E:\web\wwwroot\blog_tp5\application\admin\view\comm\header.html";i:1555177125;s:66:"E:\web\wwwroot\blog_tp5\application\admin\view\comm\left_menu.html";i:1555427913;s:65:"E:\web\wwwroot\blog_tp5\application\admin\view\comm\top_menu.html";i:1555424479;s:77:"E:\web\wwwroot\blog_tp5\application\admin\view\comm\media_table_edit_tpl.html";i:1558198016;s:63:"E:\web\wwwroot\blog_tp5\application\admin\view\comm\footer.html";i:1557550495;s:64:"E:\web\wwwroot\blog_tp5\application\admin\view\comm\confirm.html";i:1555330038;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title><?php echo htmlentities($title); ?>-<?php echo htmlentities(app('lang')->get('web_name')); ?></title>
    <link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="/static/bootstrap/css/bootstrap-theme.min.css">
<link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="/static/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="/static/css/dataTables.jqueryui.min.css">
<link rel="stylesheet" type="text/css" href="/static/css/style.css">
<link rel="icon" href="/icon.png">
<?php if(isset($KE) && $KE == "1"): ?>
<link rel="stylesheet" href="/kindeditor/themes/default/default.css" />
<link rel="stylesheet" href="/kindeditor/plugins/code/prettify.css" />
<?php endif; ?>
<script type="text/javascript" src="/static/js/jq.min.js"></script>



</head>
<body>
<div style="position:fixed;top:0;left:0;z-index: 1;width: 230px;height: 100%;background: #3e3b39;"></div>
<div class="left_mune fixed">
    <ul id="ul">
        <li class="left_top"><?php echo htmlentities(app('lang')->get('web_name')); ?></li>
        <?php if(is_array($new_menu) || $new_menu instanceof \think\Collection || $new_menu instanceof \think\Paginator): if( count($new_menu)==0 ) : echo "" ;else: $i=0; foreach($new_menu as $key=>$v): ++$i; ?>
        <li class="left_nav" style="<?php if(!isset($v['child'])): ?> display: none;<?php endif; ?>" <?php if(in_array($v['menu_name'],[$mca['c']])): ?>data-on="2"<?php endif; ?>>
            <a class="left_nav_a" href="javascript:;" >
                <i class="fa <?php echo htmlentities($v['menu_icon']); ?>"></i>
                <span><?php echo $v['add_str']; ?><?php echo htmlentities($v['menu_title']); ?></span>
                <span class="lm-float-r" >
                    <i class="fa fa-angle-right" aria-hidden="true" data-b="fa fa-angle-down" data-r="fa fa-angle-right"></i>
                </span>
            </a>
            <ul class="s-show">
            <?php if(isset($v['child'])): if(is_array($v['child']) || $v['child'] instanceof \think\Collection || $v['child'] instanceof \think\Paginator): if( count($v['child'])==0 ) : echo "" ;else: foreach($v['child'] as $k=>$val): ?>
                <li><a href="/<?php echo htmlentities($val['menu_name']); ?>" <?php if($val['menu_name'] == $mca['ca']): ?>data-on="1" class="s-color-fcfcfc" <?php endif; ?> ><?php echo $val['add_str']; ?><?php echo htmlentities($val['menu_title']); ?></a> </li>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            <?php endif; ?>
            </ul>
        </li>
        <?php endforeach; endif; else: echo "" ;endif; ?>
        <li class="left_nav" style="height: 0;"></li>
    </ul>
</div>
<script type="text/javascript">
    $(".left_mune").css("min-height",(document.documentElement.clientHeight || window.innerHeight)+"px").attr("class","left_mune");
    $(function () {

        window.left_menu_2019=function(argument){
            var menu = this.parentNode;
            var ul = $("ul",menu);
            var icon = $("span>i",this);

            (argument==1)&&(this.hide=true);
            if (this.hide){
                menu.style.height ="";
                icon.attr("class",icon.attr("data-r"));
                $(this).attr("is_click",0);
            }
            else{
                menu.style.height = (35+ul[0].offsetHeight)+"px";
                icon.attr("class",icon.attr("data-b"));
                $(this).attr("is_click",1);
            }

            this.hide = !this.hide;

            // var div = $("ul>div",this);
            console.log(ul[0],ul[0].offsetHeight);
        }
        var left_menu_a_2019 = $(".left_nav>.left_nav_a");
        left_menu_a_2019.on("click",function (e) {
            if ($(this).attr("is_click")==1){
                left_menu_2019.call(this,1);
                return false;
            }
            for (var i=0,len=left_menu_a_2019.length;i<len;i++){
                left_menu_2019.call(left_menu_a_2019[i],1);
            }
            left_menu_2019.call(this);
        });

        var on=$("a[data-on=1]");
        if(on.length>0){
            var li = on.parent().parent().parent();
            var ul = $("ul",li[0]);
            //li.css("height",(35+ul[0].offsetHeight)+"px");
            //$(".left_nav_a",li[0])[0].click();
            $(".left_nav_a",li[0]).click();
        }
        else{
            var li = $("li[data-on=2]");
            if(li.length>0){
                $(".left_nav_a",li[0]).click();
            }
            // var ul = $("ul",li[0]);
            // li.css("height",(35+ul[0].offsetHeight)+"px");
        }
    });
</script>
<script type="text/javascript">
    setTimeout(function () {
        $("body").css({opacity:1});
    },100);
</script>
<div class="top_menu">
    <nav>
        <ul class="col-sm-6 nav navbar-top-links navbar-left" style="height: 100%;line-height: 3em;">
            <li style="float: left;"><a href="/"><i class="fa fa-home"> </i>首页</a></li>
            <?php echo htmlentities($page_top = page_top()); if(is_array($page_top) || $page_top instanceof \think\Collection || $page_top instanceof \think\Paginator): if( count($page_top)==0 ) : echo "" ;else: $i=0; foreach($page_top as $key=>$v): ++$i; if(isset($v['hidden']) && $v['hidden'] == 1): ?>
            <li style="float: left;"><a href="javascript:;"><i class="fa fa-angle-right" style="margin:0 10px 0 0;"></i><?php echo htmlentities($v['name']); ?></a></li>
            <?php else: ?>
            <li style="float: left;"><a href="/<?php echo htmlentities($v['url']); ?>"><i class="fa fa-angle-right" style="margin:0 10px 0 0;"></i><?php echo htmlentities($v['name']); ?></a></li>
            <?php endif; ?>
            <?php endforeach; endif; else: echo "" ;endif; ?>

        </ul>
        <ul class="col-sm-6 nav navbar-top-links navbar-right ul_r" style="height: 100%;line-height: 3em;">
            <li>
                <a href="/admin_login_out"><i class="fa fa-sign-out"></i> 退出</a>
            </li>
            <li>
                <a href="/index/clear_cache"><i class="fa fa-trash-o"></i> 清除缓存</a>
            </li>
            <li>
                <a href="javascript:;">欢迎您 <?php echo cookie("fwf_admin_name"); ?> <i class="fa fa-unlock-alt" id="rules" href="/power/admin_edit/id/<?php echo cookie('fwf_admin_id'); ?>"></i></a>
            </li>
        </ul>
    </nav>
</div>
<script type="text/javascript">
    $(function () {
        $("body").css({overflowY:"initial"}).addClass("overflow-y-show");
        /*var top_menu = $(".top_menu");
        top_menu.attr("class","top_menu").css("width",((document.documentElement.clientWidth || window.innerWidth)-230)+"px");
        $(window).on("resize",function (e) {
            top_menu.attr("class","top_menu").css("width",((document.documentElement.clientWidth || window.innerWidth)-230)+"px");
        });*/
        $("#rules").on("click",function (e) {
            location.href = this.getAttribute("href")+"/?token="+localStorage.getItem("token");
        });

    });

</script>
<div class="container main">
    <div class="col-sm-12 border-bottom text-right"><a class="btn btn-primary mgr-10" href="/Content/article_list/id/<?php echo htmlentities($article['media_id']); ?>"><i class="fa fa-list-ul"></i>&nbsp;<?php echo htmlentities(app('lang')->get('article_list')); ?></a></div>

    <div class="col-sm-12">
        <div class="col-sm-12"> &nbsp;</div>
        <form class="form-horizontal" method="post" action="/Content/article_save/">
            <!--需要的变量$data,$category_list,$model_fields-->
<?php if(isset($model_fields) && is_array($model_fields)): if(is_array($model_fields) || $model_fields instanceof \think\Collection || $model_fields instanceof \think\Paginator): if( count($model_fields)==0 ) : echo "" ;else: $i=0; foreach($model_fields as $key=>$v): ++$i; if($v['field_name'] == "media_title" && $v['checked'] == "1"): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <input class="form-control" name="<?php echo htmlentities($v['field_name']); ?>" value="<?php echo htmlentities($data[$v['field_name']]); ?>" required>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "meida_img" && $v['checked'] == "1"): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <!--KindEditor 图片上传预览部分 单个图片-->
    <div class="col-sm-9">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <div class="s-div-img-preview" style="display:<?php if($data[$v['field_name']]): ?> block;<?php else: ?>none;<?php endif; ?>">
            <div class="s-div-img-item">
                <img src="<?php echo htmlentities($data[$v['field_name']]); ?>" id="<?php echo htmlentities($v['field_name']); ?>_img">
                <i class="fa fa-times" aria-hidden="true" iele="close"></i>
                <input type="hidden" id="<?php echo htmlentities($v['field_name']); ?>" name="<?php echo htmlentities($v['field_name']); ?>"  value="<?php echo htmlentities($data[$v['field_name']]); ?>">
            </div>
        </div>
        <div class="s-div-img-upload">
            <input type="button" class="btn btn-default" id="<?php echo htmlentities($v['field_name']); ?>_image_up_btn" value="选择图片">
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            /*单张图片*/
            var iele = $("i[iele='close']").one("click",function () {
                var input_url = $("#<?php echo htmlentities($v['field_name']); ?>");
                var img = $("#<?php echo htmlentities($v['field_name']); ?>_img");
                var img_preview = img.parent().parent();

                input_url.val("");
                img.attr("src","");
                img_preview.hide();
                iele.unbind("click");
            });
            KE.K('#<?php echo htmlentities($v['field_name']); ?>_image_up_btn').click(function() {
                KE.editor.loadPlugin('image', function() {
                    KE.editor.plugin.imageDialog({
                        imageUrl : "",
                        clickFn : function(url, title, width, height, border, align) {
                            var input_url = KE.K("#<?php echo htmlentities($v['field_name']); ?>");
                            input_url.val(url);
                            var img = KE.K("#<?php echo htmlentities($v['field_name']); ?>_img");
                            img.attr("src",url);
                            var img_preview = img.parent().parent();
                            img_preview.show();
                            var img_item = $(".s-div-img-item>i", img_preview);
                            img_item.unbind("click");
                            img_item.on("click",function (e) {
                                input_url.val("");
                                img.attr("src","");
                                $(this.parentNode.parentNode).hide();
                            });
                            KE.editor.hideDialog();
                        }
                    });
                });
            });
        });
    </script>
</div>
<?php elseif($v['field_name'] == "media_desc" && $v['checked'] == "1"): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <textarea class="form-control" name="<?php echo htmlentities($v['field_name']); ?>" rows="8" placeholder="200字内"><?php echo $data[$v['field_name']]; ?></textarea>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "media_content" && $v['checked'] == "1"): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-7">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <textarea name="<?php echo htmlentities($v['field_name']); ?>" id="<?php echo htmlentities($v['field_name']); ?><?php echo htmlentities($i); ?>" style="width: 700px;"><?php echo htmlentities($data[$v['field_name']]); ?></textarea>
    </div>
    <script type="text/javascript">
        $(function () {
            create_KE("#<?php echo htmlentities($v['field_name']); ?><?php echo htmlentities($i); ?>",{height:800,filterMode:"off"});
        });
    </script>
</div>
<?php elseif($v['field_name'] == "media_order" && $v['checked'] == "1"): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <input type="number" class="form-control" name="<?php echo htmlentities($v['field_name']); ?>" value="<?php echo $data[$v['field_name']]; ?>" required>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "media_recom" && $v['checked'] == "1"): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <label class="s-label-radio">
            <input type="radio" name="<?php echo htmlentities($v['field_name']); ?>" value="0" id="<?php echo htmlentities($v['field_name']); ?>0" <?php if(in_array($data[$v['field_name']],[0])): ?> checked <?php endif; ?>>
            <label for="<?php echo htmlentities($v['field_name']); ?>0" class="fa fa-check"></label>不推荐
        </label>
        <label class="s-label-radio">
            <input type="radio" name="<?php echo htmlentities($v['field_name']); ?>" value="1" id="<?php echo htmlentities($v['field_name']); ?>1" <?php if(in_array($data[$v['field_name']],[1])): ?> checked <?php endif; ?>>
            <label for="<?php echo htmlentities($v['field_name']); ?>1" class="fa fa-check"></label>推荐到首页
        </label>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "media_model_id" && $v['checked'] == "1"): ?>
<div class="form-group" style="display: none;">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <input type="text" class="form-control" name="<?php echo htmlentities($v['field_name']); ?>" value="<?php echo $data[$v['field_name']]; ?>" readonly>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "media_member_id" && $v['checked'] == "1"): ?>
<div class="form-group" style="display: none;">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_desc" value="<?php echo htmlentities($v['field_alias']); ?>">
        <input type="hidden" name="<?php echo htmlentities($v['field_name']); ?>_checked" value="<?php echo htmlentities($v['checked']); ?>">
        <input type="text" class="form-control" name="<?php echo htmlentities($v['field_name']); ?>" value="<?php echo $data[$v['field_name']]; ?>" readonly>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "media_category_id" &&  in_array($v['checked'],[0,1])): ?>
<div class="form-group">
    <label class="col-sm-3 control-label"><?php echo htmlentities($v['field_alias']); ?></label>
    <div class="col-sm-3">
        <select class="form-control" name="<?php echo htmlentities($v['field_name']); ?>">
            <option value="0"><?php echo htmlentities(app('lang')->get('select')); ?></option>
            <?php if(is_array($category_list) || $category_list instanceof \think\Collection || $category_list instanceof \think\Paginator): if( count($category_list)==0 ) : echo "" ;else: $j=0; foreach($category_list as $k=>$val): ++$j; ?>
            <option value="<?php echo htmlentities($val['cate_id']); ?>" <?php if(in_array($val['cate_id'],[$data[$v['field_name']]])): ?> selected<?php endif; ?>><?php echo htmlentities($val['cate_name']); ?></option>
            <?php endforeach; endif; else: echo "" ;endif; ?>
        </select>
    </div>
    <small class="col-sm-4 form-tips"></small>
</div>
<?php elseif($v['field_name'] == "medis_ext_field" && $v['checked'] == "1"): ?>
<?php endif; ?>
<?php endforeach; endif; else: echo "" ;endif; ?>
<?php endif; ?>

            <!--<div class="form-group">-->
                <!--<label class="col-sm-3 control-label"><?php echo htmlentities(app('lang')->get('article_meida_img')); ?></label>-->
                <!--&lt;!&ndash;KindEditor 图片上传预览部分&ndash;&gt;-->
                <!--<div class="col-sm-9">-->
                    <!--<div class="s-div-img-preview" style="display: none">-->
                        <!--<div class="s-div-img-item">-->
                            <!--<img src="" id="img1">-->
                            <!--<i class="fa fa-times" aria-hidden="true"></i>-->
                            <!--<input type="hidden" id="url1" name="meida_img"  value="">-->
                        <!--</div>-->
                    <!--</div>-->
                    <!--<div class="s-div-img-upload">-->
                        <!--<input type="button" class="btn btn-default" id="images_up_btn" value="选择图片">-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->


            <div class="form-group">
                <label class="col-sm-3 control-label"></label>
                <div class="col-sm-3">
                    <input type="hidden" name="media_id" value="<?php echo htmlentities($article['media_id']); ?>">
                    <input type="hidden" name="token" value="">
                    <button class="btn btn-primary" type="submit">提交保存</button>
                </div>
                <small class="col-sm-4 form-tips"></small>
            </div>

        </form>
    </div>
</div>
<script type="text/javascript" src="/static/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/static/js/app.js"></script>
<script type="text/javascript" src="/static/js/php.js"></script>
<script type="text/javascript" src="/static/js/initPage.js"></script>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" id="myModal">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" >重要提示</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary">确定</button>
            </div>
        </div>
    </div>
</div>


<div class="modal fade bs-example-modal-sm s-confirm" tabindex="-1" role="dialog" id="confirm" style="display: none;">
    <div class="modal-dialog modal-sm" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                <h4 class="modal-title" align="center">重要提示</h4>
            </div>
            <div class="modal-body">

            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div>

<div class="tips" id="tips">
    <i class="fa fa-check fa-2x" data-success="fa fa-check fa-2x" data-error="fa fa-times fa-2x"></i>
    <span></span>
</div>
<div class="tips tips-fail" id="tips_error" data-type="error">
    <i class="fa fa-times fa-2x" data-success="fa fa-check fa-2x" data-error="fa fa-times fa-2x"></i>
    <span></span>
</div>

<script type="text/javascript">
    function del(url) {
        confirms(0,{body:"确定要删除吗？"},function () {
            var token = LO.get("token",1);
            location.href=url+"?token="+token;
        });
    }
    function confirms(select,config,fn) {
        (select) || (select="#confirm");
        (config) || (config={});
        var modal = $(select);
        modal.modal();
        var c=modal[0];
        var title = config.title ? config.title : "重要提示";
        var msg = config.body ? config.body : "";
        var btn1_desc = config.btn1 ? config.btn1 : "取消";
        var btn2_desc = config.btn2 ? config.btn2 : "确定";
        var modal_title = $(".modal-title",c);
        var modal_body = $(".modal-body",c);
        var btn1 = $(".btn-white",c);
        var btn2 = $(".btn-primary",c);
        modal_title.html(title);
        modal_body.html(msg);
        btn1.html(btn1_desc);
        btn2.html(btn2_desc);

        btn2.unbind("click mousedown");
        btn2.on("click",function (e) {
            (typeof fn === "function")&&fn(1);
            modal.modal("hide");
        });
    }
    
    function tips(select,message,fn,time) {
        (select) || (select="#tips");
        (message) || (message="操作成功");
        (time) || (time=1500);
        var W=(document.documentElement.clientWidth || window.innerWidth);
        var H=(document.documentElement.clientHeight || window.innerHeight);
        var tips = $(select);
        tips.attr("class","tips tips-action");
        (tips.attr("data-type")==="error") && tips.attr("class","tips tips-action tips-fail");

        $("span",tips[0]).html(message);
        clearTimeout(tips[0].idd);
        clearTimeout(tips[0].iddd);
        tips[0].iddd=setTimeout(function () {
            tips.css({top:((H-tips[0].offsetHeight)/2)+"px",left:((W-tips[0].offsetWidth)/2)+"px",opacity:1});
        },5);
        tips[0].idd=setTimeout(function () {
            tips.css({opacity:""});
            setTimeout(function () {
                tips.attr("class","tips");
                (typeof fn === "function")&&fn();
            },300);
        },time);
    }
    function tips_success(message,fn) {
        (message) || (message = "操作成功");
        tips("#tips",message,fn);
    }
    function tips_fail(message,fn) {
        (message) || (message = "操作失败");
        tips("#tips_error",message,fn);
    }
</script>
<?php if(isset($KE) && $KE == "1"): ?>
<script charset="utf-8" src="/kindeditor/kindeditor-all-min.js"></script>
<script charset="utf-8" src="/kindeditor/lang/zh-CN.js"></script>
<?php endif; ?>
<script type="text/javascript">
    $(function () {
        /*var main = $(".main");
        main.css("width",((document.documentElement.clientWidth || window.innerWidth)-230)+"px");
        $(window).on("resize",function (e) {
            main.css("width",((document.documentElement.clientWidth || window.innerWidth)-230)+"px");
        });*/

        window.aEles=$("a");
        $("input[name=token]").val(LO.get("token",1));
        aEles.on("click",function (e) {
            var token = LO.get("token",1);
            var preg = /^javascript\:/i;
            var href="";
            if ((/^paginate_button/i).test(this.getAttribute("class"))){
                e.preventDefault();
                return false;
            }
            if( !preg.test( href = this.getAttribute("href")) ){
                e.preventDefault();
                (href == "/") && (href="");
                location.href=href+"/?token="+token;
            }

        });
    });

    var tID="myTable";
    var pageLength = parseInt(LO.get("pageLength",1),10);
    try {
        var _init_={};
        var myTable=$("#"+tID).DataTable( {
            "lengthMenu": [ 15 ,25 ,50 ,100 ,200 ,300 ,400 ,500],
            "pagingType": "full_numbers",
            //关闭排序
            "ordering": false,
            "drawCallback":function () {
                //set_myTable_tool();
                if (!_init_.ok) {
                    $(".dataTables_length select").attr("class","input-sm dt-select");
                    $(".dataTables_filter input").attr("class","inline dt-search");
                    _init_.ok = 1;
                }
            },
            "initComplete":function () {

            },
            "bSort": false,
            //设置每页显示的行数
            "pageLength": (typeof pageLength==="number") ? pageLength : 15 ,
            //语言配置
            "language":{
                // "decimal":        "",
                // "emptyTable":     "No data available in table",
                // "info":           "Showing _START_ to _END_ of _TOTAL_ entries",
                // "infoEmpty":      "Showing 0 to 0 of 0 entries",
                // "infoFiltered":   "(filtered from _MAX_ total entries)",
                // "infoPostFix":    "",
                // "thousands":      ",",
                // "lengthMenu":     "Show _MENU_ entries",
                // "loadingRecords": "Loading...",
                // "processing":     "Processing...",
                // "search":         "Search:",
                // "zeroRecords":    "No matching records found",
                // "paginate": {
                //     "first":      "First",
                //     "last":       "Last",
                //     "next":       "Next",
                //     "previous":   "Previous"
                // },
                // "aria": {
                //     "sortAscending":  ": activate to sort column ascending",
                //     "sortDescending": ": activate to sort column descending"
                // },
                "paginate":{
                    first: "首页",
                    previous: "上一页",
                    next: "下一页",
                    last: "尾页"
                },
                "lengthMenu":"每页 _MENU_ 条记录",
                "info":"显示 _START_ 到 _END_ 条，共 _TOTAL_ 条",
                "infoEmpty":"显示 0 到 _END_ 条，共 _TOTAL_ 条",
                "search":"查找：",
                "emptyTable":"暂无数据！",
            },


        });
        // set_myTable_tool();
        // function set_myTable_tool() {
        //     try {
        //         var info = myTable.page.info();
        //         $("#"+tID+"_info").html(
        //             "显示 "+(info.start+1)+" 到 "+(info.end)+" 条，共 "+(info.recordsTotal)+" 条"
        //         );
        //         $("#"+tID+"_first").html("首页");
        //         $("#"+tID+"_previous").html("上一页");
        //         $("#"+tID+"_next").html("下一页");
        //         $("#"+tID+"_last").html("尾页");
        //
        //         $("#"+tID+"_length").attr("class","col-sm-3");
        //         var label = $("#"+tID+"_length>label")[0];
        //         $("select",label).attr("class"," input-sm dt-select");
        //         label.childNodes[0].remove();
        //         label.childNodes[1].remove();
        //         label.childNodes[0].before("每页 ");
        //         label.childNodes[1].after(" 条记录");
        //         var filter = $("#"+tID+"_filter>label")[0];
        //         $("input",filter).attr("class","inline dt-search");
        //         filter.childNodes[0].remove();
        //         filter.childNodes[0].before("查找：");
        //
        //         $(".dataTables_empty").html("暂无数据！");
        //     }catch (e) {
        //
        //     }
        // }
        // function myTableSet(obj,t){
        //     var tID = "myTable";
        //     var info = obj.page.info();
        //     $("#"+tID+"_info").html(
        //         "显示 "+(info.start+1)+" 到 "+(info.end)+" 条，共 "+(info.recordsTotal)+" 条"
        //     );
        //     $("#"+tID+"_paginate").html();
        //
        //     if (t===1){
        //         $("#"+tID+"_next").on( 'click', function () {
        //             obj.page( 'next' ).draw( false );
        //             myTableSet(obj,0);
        //         } );
        //
        //         $("#"+tID+"_previous").on( "click", function () {
        //             obj.page( 'previous' ).draw( false );
        //         } );
        //     }
        //
        // }
        //myTableSet(myTable,1);

        $("#"+tID+"_length select").on("change",function (e) {
            LO.set("pageLength",this.value,1);
        });
    }catch (e) {

    }

</script>
<?php if($KE == "1"): ?>
<script type="text/javascript">
    KindEditor.ready(function(K) {
        window.KE={};
        var editor = K.editor({
            allowFileManager : true
        });
        KE.K = K;
        KE.editor = editor;
        // K('#image2').click(function() {
        //     editor.loadPlugin('image', function() {
        //         editor.plugin.imageDialog({
        //             showLocal : false,
        //             imageUrl : K('#url2').val(),
        //             clickFn : function(url, title, width, height, border, align) {
        //                 K('#url2').val(url);
        //                 editor.hideDialog();
        //             }
        //         });
        //     });
        // });
        // K('#image3').click(function() {
        //     editor.loadPlugin('image', function() {
        //         editor.plugin.imageDialog({
        //             showRemote : false,
        //             imageUrl : K('#url3').val(),
        //             clickFn : function(url, title, width, height, border, align) {
        //                 K('#url3').val(url);
        //                 editor.hideDialog();
        //             }
        //         });
        //     });
        // });
    });

    $(function () {
        /*单张图片*/
        KE.K('#image_up_btn').click(function() {
            KE.editor.loadPlugin('image', function() {
                KE.editor.plugin.imageDialog({
                    imageUrl : "",
                    clickFn : function(url, title, width, height, border, align) {
                        var input_url = KE.K("#media_img");
                        input_url.val(url);
                        var img = KE.K("#img_value");
                        img.attr("src",url);
                        var img_preview = img.parent().parent();
                        img_preview.show();
                        var img_item = $(".s-div-img-item>i", img_preview);
                        img_item.unbind("click");
                        img_item.on("click",function (e) {
                            input_url.val("");
                            img.attr("src","");
                            $(this.parentNode.parentNode).hide();
                        });
                        KE.editor.hideDialog();
                    }
                });
            });
        });

        /*预览图片*/
        $("#images_up_btn,.images_up_btn").click(function (e) {
            try {
                var img_upload = this.parentNode;
                var img_preview = this.parentNode.parentNode.getElementsByTagName("div")[0];
            }catch (e) {

            }
            KE.editor.loadPlugin('image', function() {
                KE.editor.plugin.imageDialog({
                    imageUrl : "",
                    clickFn : function(url, title, width, height, border, align) {
                        var html = "<div class=\"s-div-img-item\" _src='"+url+"'>\n" +
                            "           <img src='"+url+"' >\n" +
                            "           <i class=\"fa fa-times\" aria-hidden=\"true\"></i>\n" +
                            "           <input type=\"hidden\"  name=\"meida_imgs[]\"  value='"+url+"'>\n" +
                            "       </div>";
                        if (img_preview) {
                            $(img_preview).append(html).show();
                        }
                        var img_item = $(".s-div-img-item>i",img_preview);
                        img_item.unbind('click');
                        img_item.on("click",function (e) {
                            $(this.parentNode).remove();
                            if ($(".s-div-img-item>i",img_preview).length<1){
                                $(img_preview).hide();
                            }
                        });
                        KE.editor.hideDialog();
                    }
                });
            });
        });


    });

    var KE_del = "<?php if($KEs['del'] == '1'): ?>1<?php else: ?>0<?php endif; ?>";
    if (KE_del == "1") {
        Events.add(document,"click",function (e) {
            var e = e || window.event;
            var target = e.target || e.srcElement;
            //删除文件
            if (target.getAttribute("name") == "close_2019") {
                var img = $("div img",target.parentNode)[0];
                var path = img.getAttribute("src");
                confirms(0,{body:"确定要删除该文件吗？删除后将无法恢复"},function () {
                    clearTimeout(target.idd);
                    target.idd = setTimeout(function () {
                        $.post("/kindeditor/php/del_file.php",{path:path},function (data) {
                            data = JSON.parse(data);
                            console.log(data.code);
                            if (data.code == "1"){
                                tips_success("删除文件成功",function () {
                                    img.parentNode.parentNode.parentNode.removeChild(img.parentNode.parentNode);
                                });
                            }else{
                                tips_fail("删除文件失败");
                            }
                        });
                    },500);
                });
            }
        },true);
        Events.add(document,"mouseover",function (e) {
            var e = e || window.event;
            var target = e.target || e.srcElement;
            var href = target.getAttribute("_href");
            if (/(\.jpg$|\.png$|\.gif$|\.jpeg$|\.bmp$)/i.test(href)) {
                //alert("tupian");
                console.log(target.parentNode.parentNode.childNodes[0].className="");
            }
        },true);

    }

    //创建富文本编辑器
    function create_KE(select,C,fn) {
        (select) || (select="#media_content");
        (C) || (C = {});
        (C.height) || (C.height=500);
        (C.items) || (C.items=[
            'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
            'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
            'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
            'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
            'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
            'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image', /*'multiimage',*/
            /*'flash',*/ /*'media',*/ 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
            'anchor', 'link', 'unlink', /*'|',*/ /*'about'*/
        ]);
        // 关闭过滤模式，保留所有标签
        (C.filterMode == "off" || C.filterMode === 0 )&&(KindEditor.options.filterMode = false);
        var config = {
            height:C.height,
            //显示图片空间
            allowFileManager:true,
            //编辑器创建时的回调函数
            afterCreate:function(){
                (typeof fn ==="function")&&fn.call(this,"afterCreate");
                /*粘贴图片功能，比如截图 start*/
                var editor = this;
                var editerDoc = this.edit.doc;//得到编辑器的文档对象
                //监听粘贴事件, 包括右键粘贴和ctrl+v
                $(editerDoc).bind('paste', null, function (e) {
                    /*获得操作系统剪切板里的项目，e即kindeditor,
                    *kindeditor创建了originalEvent(源事件)对象，
                    *并指向了浏览器的事件对象，而chrome浏览器
                    *需要通过clipboardData(剪贴板数据)对象的items
                    *获得复制的图片数据。
                    */
                    var ele = e.originalEvent.clipboardData.items;
                    for (var i = 0; i < ele.length; ++i) {
                        //判断文件类型
                        if (ele[i].kind == 'file' && ele[i].type.indexOf('image/') !== -1) {
                            var file = ele[i].getAsFile();//得到二进制数据
                            //创建表单对象，建立name=value的表单数据。
                            var formData = new FormData();
                            formData.append("imgFile", file);//name,value

                            //用jquery Ajax 上传二进制数据
                            $.ajax({
                                url: "/kindeditor/php/upload_json.php",
                                type: 'POST',
                                data: formData,
                                // 告诉jQuery不要去处理发送的数据
                                processData: false,
                                // 告诉jQuery不要去设置Content-Type请求头
                                contentType: false,
                                dataType: "json",
                                beforeSend: function () {
                                    //console.log("正在进行，请稍候");
                                },
                                success: function (responseStr) {
                                    //上传完之后，生成图片标签回显图片，假定服务器返回url。
                                    var src = responseStr.url;
                                    var imgTag = "<img src='" + src + "' border='0'/>";

                                    //console.info(imgTag);
                                    //kindeditor提供了一个在焦点位置插入HTML的函数，调用此函数即可。
                                    editor.insertHtml(imgTag);


                                },
                                error: function (responseStr) {
                                    console.log("error");
                                }
                            });
                        }
                    }
                });
                /*粘贴图片功能，比如截图 end*/
            },
            //编辑器内容发生变化后执行的回调函数
            afterChange:function () {
                //alert('abc');
                (typeof fn ==="function")&&fn.call(this,"afterChange");
            },
            //编辑器聚焦(focus)时执行的回调函数
            afterFocus:function (){
                (typeof fn ==="function")&&fn.call(this,"afterFocus");
            },
            //编辑器失去焦点(blur)时执行的回调函数
            afterBlur:function(){
                (typeof fn ==="function")&&fn.call(this,"afterBlur");
            },
            //上传文件后执行的回调函数
            afterUpload:function(){
                (typeof fn ==="function")&&fn.call(this,"afterUpload");
            },
            //从图片空间选择文件后执行的回调函数
            afterSelectFile:function () {
                (typeof fn ==="function")&&fn.call(this,"afterSelectFile");
            },
        };
        for (var attr in C){
            config[attr] = C[attr];
        }
        KindEditor.create(select,config);
    }
</script>
<?php endif; ?>

<script type="text/javascript">
    function toTop() {
        move.move(document.body, {scrollTop:0},500,false,1);
        move.move(document.documentElement, {scrollTop:0},500,false,1);
    }
    Events.add(window,'scroll',function (e) {
        var target = Events.getTarget(e);
        var scrollTop = document.documentElement.scrollTop>0 ? document.documentElement.scrollTop : document.body.scrollTop;
        clearTimeout(document.idd2019);
        document.idd2019 = setTimeout(function () {
            if (scrollTop>=400){
                $(".s-toTop").attr("class","s-toTop");
            } else{
                $(".s-toTop").attr("class","s-toTop s-toTop-hide");
            }
        },300);
    },true);
</script>

<div class="s-toTop s-toTop-hide">
    <i class="fa  fa-angle-up" onclick="toTop()"></i>
</div>
<script type="text/javascript">


</script>
</body>
</html>